<?php defined('RUN_KATANA') or die('Restricted access'); ?>
<?php echo $commander->getListCommandsPanel('s', ''); ?>
<div class="menu_list">
	<table style="clear:both;" id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
        <thead class="fields">
            <tr>
                <th class="first center">&nbsp;&nbsp;Id&nbsp;&nbsp;</th>
                <th><?php echo ucfirst($txt->getWord('name')); ?></th>
                <th class="last"><?php echo ucfirst($txt->getWord('edit')); ?></th>
            </tr>
        </thead>
        <tbody>
        	<tr class="items">
	            <td class="first center">#</td>
	            <td>
                	 <select id="add_brand_id" name="add_brand_id" class="medium">
                        <option value="0"><?php echo ucfirst($txt->getWord('select')).' '.$txt->getWord('brand'); ?></option>
                        <?php
                        foreach($shop->getBrands() as $brand)
                        {
                            if(!($shop->CurrentProvider->getBrand($brand->getId())))
                            { echo '<option value="'.$brand->getId().'" >'.$brand->getTitle().'</option>';  }
                        }
                        ?>
                    </select>&nbsp;
                </td>
	            <td class="last"><img title="<?php echo ucfirst($txt->getWord('add')); ?>" class="icon command" src="<?php echo SYSICONS_URL; ?>add_16.gif"  onclick="edit_form.submit();" /></td>
	        </tr>
            <?php 
            if($shop->CurrentProvider->getBrands())
			{
				foreach($shop->CurrentProvider->getBrands() as $brand)
				{
				?>
				<tr class="items">
					<td class="first center"><?php echo $brand->getId(); ?><input type="hidden" name="brand_id[]" value="<?php echo $brand->getId(); ?>" /></td>
					<td><input class="medium" name="brand_title[]" type="text" value="<?php echo $brand->getTitle(); ?>" maxlength="80" /></td>
					<td class="last">
					<img title="<?php echo ucfirst($txt->getWord('remove').' '.$txt->getWord('brand')); ?>" class="icon command brand_delete" src="<?php echo SYSICONS_URL; ?>delete_16.gif" onclick="deleteDialogBrand(<?php echo $brand->getId(); ?>);" />
					</td>
				</tr>
				<?php
            	}
			}
            ?>
        </tbody>
    </table>
    <input type="hidden" name="rem_brand_id" id="rem_brand_id" value="0" />
</div>
<script type="text/javascript">
function deleteDialogBrand(itemId)
{
	jQuery('#delete_dialog_brand').dialog('open');
	jQuery('#delete_dialog_brand').dialog({
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no')); ?>': function() 
			{
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('remove')).' '.$txt->getWord('element'); ?>': function() 
			{
				jQuery('#rem_brand_id').val(itemId);
				jQuery(this).dialog('close');
				jQuery('#edit_form').submit();
			}
		}
	});
}
</script>
<div id="delete_dialog_brand" title="<?php echo ucfirst($txt->getWord('remove').' '.$txt->getWord('brand')); ?>?" style="display:none; text-align:left;">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo ucfirst($txt->getWord('sure_you_want_to_delete')); ?></p>
</div>